import http from '@/utils/request'

export const apiGetMindDetails = (id: string): Promise<any> => {
  return http({
    url: `/api/v1/mind/details?id=${id}`,
    method: 'get'
  })
}

export const apiPatchMindMap = (data): Promise<any> => {
  return http({
    url: '/api/v1/mind/map/patch',
    method: 'put',
    data
  })
}

export const apiNewMindMap = (data): Promise<any> => {
  return http({
    url: '/api/v1/mind/map',
    method: 'post',
    data
  })
}

export const apiDeleteMindMap = (data): Promise<any> => {
  return http({
    url: '/api/v1/mind/map',
    method: 'delete',
    data
  })
}

export const apiRenameMap = (data): Promise<any> => {
  return http({
    url: '/api/v1/mind/map/rename',
    method: 'post',
    data
  })
}

export const apiMapJsonFullUpdate = (data): Promise<any> => {
  return http({
    url: '/api/v1/mind/map/full-update',
    method: 'post',
    data
  })
}

export const apiGetMindMapJson = (params): Promise<any> => {
  return http({
    url: '/api/v1/mind/map/map-json',
    method: 'get',
    params
  })
}

export const apiSetMindCoverImage = (id: string): Promise<any> => {
  return http({
    url: `/api/v1/mind/map/cover-image?id=${id}`,
    method: 'get'
  })
}

export const apiExportMindMapImage = (data): Promise<any> => {
  return http({
    url: '/api/v1/mind/map/export-image',
    method: 'post',
    data,
    responseType: 'blob'
  })
}

export const apiExportMindMapPDF = (data): Promise<any> => {
  return http({
    url: '/api/v1/mind/map/export-pdf',
    method: 'post',
    data,
    responseType: 'blob'
  })
}
